package no_git_group.applogic2;

import java.util.List;

import org.openqa.selenium.Alert;

import no_git_group.model.Film;
import no_git_group.applogic.FilmHelper;

public class FilmHelper2 extends DriverBasedHelper implements FilmHelper {

  public FilmHelper2(ApplicationManager2 manager) {
    super(manager.getWebDriver());
  }

  @Override
  public void create(Film film) {
	  pages.homePage.clickAddMovie();
	  pages.addMoviePage
	  .setTitle(film.getTitle())
	  .setYear(film.getYear())
	  .clickSubmit();
  }

  @Override
  public void delete(Film film) {
	  //pages.homePage.openMovie(film.getTitle());
	  pages.moviePage.deleteMovie();
	  driver.switchTo().alert().accept();
  }
  
  @Override
  public boolean isMovieFound() {
	  //pages.homePage.openMovie(film.getTitle());
	  return pages.homePage.isErrorFound();	  
  }

  @Override
  public List<Film> search(String title) {
    // TODO Auto-generated method stub
	  //Film foundMovie = new Film();
	pages.homePage.searchMovie(title);
    return null;
  }

}
